package com.nd.qa.shareplate.service.impl;

import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.nd.qa.shareplate.IDao.ShareScriptMapper;
import com.nd.qa.shareplate.model.ShareScript;
import com.nd.qa.shareplate.service.ShareScriptService;

@Service("com.nd.qa.shareplate.service.ShareScriptService")
public class ShareScriptServiceImpl implements ShareScriptService {

	@Autowired
	private ShareScriptMapper scriptMapper;
	
	
	@Override
	public void insertSciptInfo(ShareScript script) {
		scriptMapper.insertSciptInfo(script);
	}

	@Override
	public List<ShareScript> queryScripts(ShareScript script) {
		return scriptMapper.queryScripts(script);
	}

	@Override
	public List<ShareScript> queryLimitScript(HashMap<String, Object> param) throws Exception {
		return scriptMapper.queryLimitScript(param);
	}

	@Override
	public List<ShareScript> queryLatestScriptByUserId(ShareScript script) throws Exception {
		return scriptMapper.queryLatestScriptByUserId(script);
	}

	@Override
	public void delScript(ShareScript script) throws Exception {
		scriptMapper.delScript(script);
	}

	@Override
	public void updateScriptInfo(ShareScript script) throws Exception {
		scriptMapper.updateScriptInfo(script);
	}
	
	   @Override
	    public void updateScriptInfo(Integer scriptId,String dentryId) throws Exception {
	        HashMap<String,Object> paramMap = new HashMap<String,Object>();
	        paramMap.put("scriptId", scriptId);
	        paramMap.put("dentryId", dentryId);
	        scriptMapper.updateScriptInfoDentry(paramMap);
	    }
	   
       @Override
       public void updateScriptUploadStatus(Integer scriptId,Integer uploadStatus) throws Exception {
           HashMap<String,Object> paramMap = new HashMap<String,Object>();
           paramMap.put("scriptId", scriptId);
           paramMap.put("uploadStatus", uploadStatus);
           scriptMapper.updateScriptUploadStatus(paramMap);
       }

}
